package com.cdck.safe.dete.controller;

import com.cdck.safe.dete.common.result.Result;

import com.cdck.safe.dete.model.vo.ResourceStatisticVO;
import com.cdck.safe.dete.service.DataStatisticsService;
import io.swagger.annotations.Api;

import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api(value = "数据统计")
@RestController
@RequestMapping("/dataStatistical")
@RequiredArgsConstructor
public class DataStatisticsController {
    private final DataStatisticsService dataStatisticsService;


    @ApiOperation(value = "TopCard数据")
    @GetMapping("/top/booking/data")
    public Result<Map> getTopBookingData() {
        Map result = dataStatisticsService.getTopBookingData();
        return Result.success(result);
    }

    @ApiOperation(value = "获取最近7/14天预约情况")
    @GetMapping("/recent/booking/{days}")
    public Result<Map> getRecentBookingData(@PathVariable("days") Integer days) {
        Map result = dataStatisticsService.getRecentBookingData(days);
        return Result.success(result);
    }

    @ApiOperation(value = "30天内资源使用情况")
    @GetMapping("/recent/resource/use")
    public Result<Map> getResourceUse() {
        Map result = dataStatisticsService.getResourceUse();
        return Result.success(result);
    }

    @ApiOperation(value = "物资利用率")
    @GetMapping("/recent/resource")
    public Result<List<ResourceStatisticVO>> getRecentResource() {
        List<ResourceStatisticVO> result = dataStatisticsService.getRecentResource();
        return Result.success(result);
    }
}
